package com.itheima1.controller;


import com.itheima.common.entity.Result;
import com.itheima1.pojo.Setmeal;
import com.itheima1.service.ISetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 博~
 * @since 2024-12-22
 */
@RestController
@RequestMapping("/setmeal")
@Api(tags = "套餐管理")
public class SetmealController {
    @Autowired
    private ISetmealService setmealService;

    @PostMapping("/getSetmeal")
    @ApiOperation("查询套餐")
    public Result getSetmeal(){
        List<Setmeal> setmealList = setmealService.getSetmeal();
        return new Result(true,"查询成功",setmealList);
    }
    @PostMapping("/findById")
    @ApiOperation("根据id查询套餐")
    public Result findById(@RequestParam Integer id){
        Setmeal setmeal = setmealService.findById(id);
        return new Result(true,"查询成功",setmeal);
    }


}
